<?php
// +----------------------------------------------------------------------
// | 后台用户管理
// +----------------------------------------------------------------------
namespace app\common\model;
use think\Model;

class News extends Model
{
	use \base\model\ModelTrait;
	/**
    * 获取时只取字段
    */
	public $fields = [];
	/**
    * 错误信息
    */
	public $errorInfo;
	/**
    * 验证规则
    */
	protected $rule = [];
	
	//获取器-是否收藏
	public function getContentsAttr($value){
		return htmlspecialchars_decode($value);
    }
	
	/**
    * 搜店铺
    * @return type
    */
	public function search($where=[],$pageIndex=1,$pageSize=20,$fields="*")
    {
    	$model = new self;
		$model = $model->where($where);
		$model = $model->where('is_enable',1);
		$model = $model->field($fields);
		$model = $model->page($pageIndex,$pageSize);
		$model = $model->order('add_time desc');
		$result = $model->all();
		return $result;
    }
	
	
	/**
     * 获取详情 
     * @return type
     */
	public function details($id)
    {
		//商品
		$details = self;
		$details = $details->where('is_enable',1);
		return $details ->get($id);
    }
}
